<template>
  <div>
    <h1>2、查询某图书信息</h1>
    <input type="text" v-model="bookname" placeholder="输入要查询的书名">
    <button @click="searchFn">查询-看控制台</button>
  </div>
</template>

<script>
import axios from "axios"
export default {
  data(){
    return {
      bookname: ""
    }
  },
  methods:{
    searchFn(){
      // 总结：axios  get请求需要通过params进行传参
      axios({
        url: "http://123.57.109.30:3006/api/getbooks",
        method: "get",
        params: {
          bookname: this.bookname
        }
      }).then(res=>{
        console.log(res);
      })
    }
  }
}
</script>

<style>

</style>